package com.example.crossborderecommerce.entity;

import lombok.Data;

/**
 * 返回体
 */
@Data
public class Result {
    private Integer code;
    private String message;
    private Object data;

    public static Result success(Object obj) {
        return new Result(200, "", obj);
    }
    public static Result success(String msg) {
        return new Result(200, msg, null);
    }

    public static Result success(String msg, Object obj) {
        return new Result(200, msg, obj);
    }

    public static Result error(String msg) {
        return new Result(400, msg, null);
    }

    public static Result error(String msg, Object obj) {
        return new Result(400, msg, obj);
    }

    public static Result error(Integer code, String msg,Object obj) {
        return new Result(code, msg, obj);
    }

    public Result(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
